﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract OSGrupa typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class OSGrupaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<OSGrupaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.OSGrupa _currentOSGrupa = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxOSGrupaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxOSGrupaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxOSGrupaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Oznaka property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxOznakaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Naziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNazivDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKontoNabavka property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoNabavkaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKontoIspravka property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoIspravkaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKontoTroska property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoTroskaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the RedBr property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxRedBrDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Konto> _IDKontoNabavkaList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoNabavkaList
		{
			get {return this._IDKontoNabavkaList;}
			set 
			{
				this._IDKontoNabavkaList = value;
				this.uxIDKontoNabavkaDataGridViewColumn.DataSource = null;
				this.uxIDKontoNabavkaDataGridViewColumn.DataSource = this._IDKontoNabavkaList;
			}
		}
		
		private bool _allowNewItemInIDKontoNabavkaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoNabavkaList
		{
			get { return _allowNewItemInIDKontoNabavkaList;}
			set
			{
				this._allowNewItemInIDKontoNabavkaList = value;
				this.uxIDKontoNabavkaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Konto> _IDKontoIspravkaList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoIspravkaList
		{
			get {return this._IDKontoIspravkaList;}
			set 
			{
				this._IDKontoIspravkaList = value;
				this.uxIDKontoIspravkaDataGridViewColumn.DataSource = null;
				this.uxIDKontoIspravkaDataGridViewColumn.DataSource = this._IDKontoIspravkaList;
			}
		}
		
		private bool _allowNewItemInIDKontoIspravkaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoIspravkaList
		{
			get { return _allowNewItemInIDKontoIspravkaList;}
			set
			{
				this._allowNewItemInIDKontoIspravkaList = value;
				this.uxIDKontoIspravkaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Konto> _IDKontoTroskaList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoTroskaList
		{
			get {return this._IDKontoTroskaList;}
			set 
			{
				this._IDKontoTroskaList = value;
				this.uxIDKontoTroskaDataGridViewColumn.DataSource = null;
				this.uxIDKontoTroskaDataGridViewColumn.DataSource = this._IDKontoTroskaList;
			}
		}
		
		private bool _allowNewItemInIDKontoTroskaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoTroskaList
		{
			get { return _allowNewItemInIDKontoTroskaList;}
			set
			{
				this._allowNewItemInIDKontoTroskaList = value;
				this.uxIDKontoTroskaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.OSGrupa> _OSGrupaList;
				
		/// <summary> 
		/// The list of OSGrupa to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.OSGrupa> OSGrupaList
		{
			get {return this._OSGrupaList;}
			set
			{
				this._OSGrupaList = value;
				this.uxOSGrupaBindingSource.DataSource = null;
				this.uxOSGrupaBindingSource.DataSource = value;
				this.uxOSGrupaDataGridView.DataSource = null;
				this.uxOSGrupaDataGridView.DataSource = this.uxOSGrupaBindingSource;				
				//this.uxOSGrupaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxOSGrupaBindingSource_ListChanged);
				this.uxOSGrupaBindingSource.CurrentItemChanged += new System.EventHandler(OnOSGrupaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnOSGrupaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentOSGrupa = uxOSGrupaBindingSource.Current as Entities.OSGrupa;
			
			if (_currentOSGrupa != null)
			{
				_currentOSGrupa.Validate();
			}
			//_OSGrupa.Validate();
			OnCurrentEntityChanged();
		}

		//void uxOSGrupaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.OSGrupa"/> instance.
		/// </summary>
		public Entities.OSGrupa SelectedOSGrupa
		{
			get {return this._currentOSGrupa;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxOSGrupaDataGridView.VirtualMode;}
			set
			{
				this.uxOSGrupaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxOSGrupaDataGridView.AllowUserToAddRows;}
			set {this.uxOSGrupaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxOSGrupaDataGridView.AllowUserToDeleteRows;}
			set {this.uxOSGrupaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxOSGrupaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxOSGrupaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="OSGrupaDataGridViewBase"/> class.
		/// </summary>
		public OSGrupaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxOSGrupaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxOSGrupaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxOSGrupaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxOznakaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDKontoNabavkaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDKontoIspravkaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDKontoTroskaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxRedBrDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDKontoNabavkaBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoNabavkaBindingSource)).BeginInit();
			//this.uxIDKontoIspravkaBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoIspravkaBindingSource)).BeginInit();
			//this.uxIDKontoTroskaBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoTroskaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSGrupaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSGrupaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSGrupaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxOSGrupaErrorProvider
			// 
			this.uxOSGrupaErrorProvider.ContainerControl = this;
			this.uxOSGrupaErrorProvider.DataSource = this.uxOSGrupaBindingSource;						
			// 
			// uxOSGrupaDataGridView
			// 
			this.uxOSGrupaDataGridView.AutoGenerateColumns = false;
			this.uxOSGrupaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxOSGrupaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxOznakaDataGridViewColumn,
		this.uxNazivDataGridViewColumn,
		this.uxIDKontoNabavkaDataGridViewColumn,
		this.uxIDKontoIspravkaDataGridViewColumn,
		this.uxIDKontoTroskaDataGridViewColumn,
		this.uxRedBrDataGridViewColumn			});
			this.uxOSGrupaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxOSGrupaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxOSGrupaDataGridView.Name = "uxOSGrupaDataGridView";
			this.uxOSGrupaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxOSGrupaDataGridView.TabIndex = 0;	
			this.uxOSGrupaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxOSGrupaDataGridView.EnableHeadersVisualStyles = false;
			this.uxOSGrupaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnOSGrupaDataGridViewDataError);
			this.uxOSGrupaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOSGrupaDataGridViewCellValueNeeded);
			this.uxOSGrupaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOSGrupaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxOznakaDataGridViewColumn
			//
			this.uxOznakaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxOznakaDataGridViewColumn.DataPropertyName = "Oznaka";
			this.uxOznakaDataGridViewColumn.HeaderText = "Oznaka";
			this.uxOznakaDataGridViewColumn.Name = "uxOznakaDataGridViewColumn";
			this.uxOznakaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxOznakaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxOznakaDataGridViewColumn.ReadOnly = false;		
			//
			// uxNazivDataGridViewColumn
			//
			this.uxNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNazivDataGridViewColumn.DataPropertyName = "Naziv";
			this.uxNazivDataGridViewColumn.HeaderText = "Naziv";
			this.uxNazivDataGridViewColumn.Name = "uxNazivDataGridViewColumn";
			this.uxNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoNabavkaDataGridViewColumn
			//
			this.uxIDKontoNabavkaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoNabavkaDataGridViewColumn.DataPropertyName = "IDKontoNabavka";
			this.uxIDKontoNabavkaDataGridViewColumn.HeaderText = "IDKontoNabavka";
			this.uxIDKontoNabavkaDataGridViewColumn.Name = "uxIDKontoNabavkaDataGridViewColumn";
			this.uxIDKontoNabavkaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoNabavkaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoNabavkaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoIspravkaDataGridViewColumn
			//
			this.uxIDKontoIspravkaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoIspravkaDataGridViewColumn.DataPropertyName = "IDKontoIspravka";
			this.uxIDKontoIspravkaDataGridViewColumn.HeaderText = "IDKontoIspravka";
			this.uxIDKontoIspravkaDataGridViewColumn.Name = "uxIDKontoIspravkaDataGridViewColumn";
			this.uxIDKontoIspravkaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoIspravkaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoIspravkaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoTroskaDataGridViewColumn
			//
			this.uxIDKontoTroskaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoTroskaDataGridViewColumn.DataPropertyName = "IDKontoTroska";
			this.uxIDKontoTroskaDataGridViewColumn.HeaderText = "IDKontoTroska";
			this.uxIDKontoTroskaDataGridViewColumn.Name = "uxIDKontoTroskaDataGridViewColumn";
			this.uxIDKontoTroskaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoTroskaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoTroskaDataGridViewColumn.ReadOnly = false;		
			//
			// uxRedBrDataGridViewColumn
			//
			this.uxRedBrDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxRedBrDataGridViewColumn.DataPropertyName = "RedBr";
			this.uxRedBrDataGridViewColumn.HeaderText = "RedBr";
			this.uxRedBrDataGridViewColumn.Name = "uxRedBrDataGridViewColumn";
			this.uxRedBrDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxRedBrDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxRedBrDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoNabavkaDataGridViewColumn
			//				
			this.uxIDKontoNabavkaDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoNabavkaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoNabavkaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoNabavkaDataGridViewColumn.DataSource = uxIDKontoNabavkaBindingSource;				
				
			//
			// uxIDKontoIspravkaDataGridViewColumn
			//				
			this.uxIDKontoIspravkaDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoIspravkaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoIspravkaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoIspravkaDataGridViewColumn.DataSource = uxIDKontoIspravkaBindingSource;				
				
			//
			// uxIDKontoTroskaDataGridViewColumn
			//				
			this.uxIDKontoTroskaDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoTroskaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoTroskaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoTroskaDataGridViewColumn.DataSource = uxIDKontoTroskaBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxOSGrupaDataGridView);
			this.Name = "OSGrupaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoNabavkaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoIspravkaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoTroskaBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSGrupaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSGrupaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSGrupaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				OSGrupaDataGridViewEventArgs args = new OSGrupaDataGridViewEventArgs();
				args.OSGrupa = _currentOSGrupa;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class OSGrupaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.OSGrupa	_OSGrupa;
	
			/// <summary>
			/// the  Entities.OSGrupa instance.
			/// </summary>
			public Entities.OSGrupa OSGrupa
			{
				get { return _OSGrupa; }
				set { _OSGrupa = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxOSGrupaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnOSGrupaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxOSGrupaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOSGrupaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOSGrupaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = OSGrupaList[e.RowIndex].ID;
						break;
					case "uxOznakaDataGridViewColumn":
						e.Value = OSGrupaList[e.RowIndex].Oznaka;
						break;
					case "uxNazivDataGridViewColumn":
						e.Value = OSGrupaList[e.RowIndex].Naziv;
						break;
					case "uxIDKontoNabavkaDataGridViewColumn":
						e.Value = OSGrupaList[e.RowIndex].IDKontoNabavka;
						break;
					case "uxIDKontoIspravkaDataGridViewColumn":
						e.Value = OSGrupaList[e.RowIndex].IDKontoIspravka;
						break;
					case "uxIDKontoTroskaDataGridViewColumn":
						e.Value = OSGrupaList[e.RowIndex].IDKontoTroska;
						break;
					case "uxRedBrDataGridViewColumn":
						e.Value = OSGrupaList[e.RowIndex].RedBr;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxOSGrupaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOSGrupaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOSGrupaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						OSGrupaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxOznakaDataGridViewColumn":
						OSGrupaList[e.RowIndex].Oznaka = (System.String)e.Value;
						break;
					case "uxNazivDataGridViewColumn":
						OSGrupaList[e.RowIndex].Naziv = (System.String)e.Value;
						break;
					case "uxIDKontoNabavkaDataGridViewColumn":
						OSGrupaList[e.RowIndex].IDKontoNabavka = (System.Int32)e.Value;
						break;
					case "uxIDKontoIspravkaDataGridViewColumn":
						OSGrupaList[e.RowIndex].IDKontoIspravka = (System.Int32)e.Value;
						break;
					case "uxIDKontoTroskaDataGridViewColumn":
						OSGrupaList[e.RowIndex].IDKontoTroska = (System.Int32)e.Value;
						break;
					case "uxRedBrDataGridViewColumn":
						OSGrupaList[e.RowIndex].RedBr = (System.Int32?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
